﻿Namespace Prim.Bordro
	Module Functions

		Sub PrimKaydet(Token As Token, isyerino As String, bordrotar As Date, bordro As String,
	kimlik As String, sno As String, pasaport As String,
	pek As Decimal, pogs As Integer, makbuzno As Integer,
	kaykul As String, islemtar As Date, taksit As String)
			Q("insert into shesk (kimlik,pasaport,sno,isyerino,bordro,bordrotar,pek,pogs,makbuzno,kaykul,islemtar,taksit)")
			Q("values (@kimlik,@pasaport,@sno,@isyerino,@bordro,@bordrotar,@pek,@pogs,@makbuzno,@kaykul,@islemtar,@taksit)")
			Token.ExecSQL("*", kimlik, pasaport, sno, isyerino, bordro, bordrotar, pek, pogs, makbuzno, kaykul, islemtar, taksit)
		End Sub

		Sub ProblemliPrimKaydet(Token As Token, isyerino As String, bordrotar As Date, bordro As String,
		 kimlik As String, sno As String, pasaport As String, adi As String, soyadi As String,
		 pek As Decimal, pogs As Integer, makbuzno As Integer,
		 kaykul As String, islemtar As Date, taksit As String)
			Q("insert into sheskp (kimlik,pasaport,sno,adi,soyadi,isyerino,bordro,bordrotar,pek,pogs,makbuzno,kaykul,islemtar,taksit)")
			Q("values (@kimlik,@pasaport,@sno,@adi,@soyadi,@isyerino,@bordro,@bordrotar,@pek,@pogs,@makbuzno,@kaykul,@islemtar,@taksit)")
			Token.ExecSQL("*", kimlik, pasaport, sno, adi, soyadi, isyerino, bordro, bordrotar, pek, pogs, makbuzno, kaykul, islemtar, taksit)
		End Sub

		Sub MakbuzKaydetIsyeri(Token As Token, isyerino As String, bordrotar As Date, bordro As String,
		 pekt As Decimal, pogst As Integer, prim As Decimal,
		 iscisay As Integer, primtahakkuk As Decimal, geczam As Decimal, faiz As Decimal, tahsilatt As Decimal, borc As Decimal,
		 makbuzno As Integer, sislem As String, tahsilattipi As String, islemtar As Date, kaykul As String,
		 alacak As Decimal, primgen As Decimal, tkcek As String)
			Q("insert into pgenel (isyerino,bordro,bordrotar,pekt,pogst,prim,iscisay,primtahakkuk,geczam,faiz,tahsilatt,borc,makbuzno,sislem,tahsilattipi,islemtar,kaykul,alacak,primgen,tkcek)")
			Q("values (@isyerino,@bordro,@bordrotar,@pekt,@pogst,@prim,@iscisay,@primtahakkuk,@geczam,@faiz,@tahsilatt,@borc,@makbuzno,@sislem,@tahsilattipi,@islemtar,@kaykul,@alacak,@primgen,@tkcek)")
			Token.ExecSQL("*", isyerino, bordro, bordrotar, pekt, pogst, prim, iscisay, primtahakkuk, geczam, faiz, tahsilatt, borc, makbuzno, sislem, tahsilattipi, islemtar, kaykul, alacak, primgen, tkcek)
			Dim Hisse As New Prim.Hisse(bordrotar, bordro, pekt, prim)
			Q("insert into pgeneloran (makbuzno,shisse,isvhisse,devhisse,iks,ikisv,ikdev,iszs,iszisv,iszdev,hass,hasisv,hasdev,moys,moyisv,moydev,anas,anaisv,anadev,islemtar,kaykul,tkcek)")
			Q("values (@makbuzno,@shisse,@isvhisse,@devhisse,@iks,@ikisv,@ikdev,@iszs,@iszisv,@iszdev,@hass,@hasisv,@hasdev,@moys,@moyisv,@moydev,@anas,@anaisv,@anadev,@islemtar,@kaykul,@tkcek)")
			Token.ExecSQL("*", makbuzno, Hisse.Sigortali.Toplam, Hisse.Isveren.Toplam, Hisse.Devlet.Toplam,
			  Hisse.Sigortali.Iskazasi, Hisse.Isveren.Iskazasi, Hisse.Devlet.Iskazasi,
			  Hisse.Sigortali.Issizlik, Hisse.Isveren.Issizlik, Hisse.Devlet.Issizlik,
			  Hisse.Sigortali.Hastalik, Hisse.Isveren.Hastalik, Hisse.Devlet.Hastalik,
			  Hisse.Sigortali.Yaslilik, Hisse.Isveren.Yaslilik, Hisse.Devlet.Yaslilik,
			  Hisse.Sigortali.Analik, Hisse.Isveren.Analik, Hisse.Devlet.Analik,
			  islemtar, kaykul, tkcek)
		End Sub

		Sub PGenelOranDuzelt(Token As Token, makbuzno As Integer)
			Dim Rs = Token.OpenSQL("select * from pgenel where makbuzno = @makbuzno", makbuzno)
			Dim Hisse As New Prim.Hisse(Rs("bordrotar"), Rs("bordro"), Rs("pekt"), Rs("prim"))
			Token.ExecSQL("delete from pgeneloran where makbuzno = @makbuzno", makbuzno)
			Q("insert into pgeneloran (makbuzno,shisse,isvhisse,devhisse,iks,ikisv,ikdev,iszs,iszisv,iszdev,hass,hasisv,hasdev,moys,moyisv,moydev,anas,anaisv,anadev,islemtar,kaykul,tkcek)")
			Q("values (@makbuzno,@shisse,@isvhisse,@devhisse,@iks,@ikisv,@ikdev,@iszs,@iszisv,@iszdev,@hass,@hasisv,@hasdev,@moys,@moyisv,@moydev,@anas,@anaisv,@anadev,@islemtar,@kaykul,@tkcek)")
			Token.ExecSQL("*", makbuzno, Hisse.Sigortali.Toplam, Hisse.Isveren.Toplam, Hisse.Devlet.Toplam,
			  Hisse.Sigortali.Iskazasi, Hisse.Isveren.Iskazasi, Hisse.Devlet.Iskazasi,
			  Hisse.Sigortali.Issizlik, Hisse.Isveren.Issizlik, Hisse.Devlet.Issizlik,
			  Hisse.Sigortali.Hastalik, Hisse.Isveren.Hastalik, Hisse.Devlet.Hastalik,
			  Hisse.Sigortali.Yaslilik, Hisse.Isveren.Yaslilik, Hisse.Devlet.Yaslilik,
			  Hisse.Sigortali.Analik, Hisse.Isveren.Analik, Hisse.Devlet.Analik,
			  Rs("islemtar"), Rs("kaykul"), Rs("tkcek"))
		End Sub

		Sub EmanettenDus(Token As Token, isyerino As String, tahsilno As Integer, tahsiltar As Date, makbuz As Integer,
			makbuzmik As Decimal, emanmikt As Decimal, emanmikk As Decimal,
			islemtar As Date, kaykul As String)
			Q("insert into emanet (isyerino,tahsilno,tahsiltar,makbuz,makbuzmik,emanmikt,emanmikk,islemtar,kaykul,hno,emanettar)")
			Q("values (@isyerino,@tahsilno,@tahsiltar,@makbuz,@makbuzmik,@emanmikt,@emanmikk,@islemtar,@kaykul,@hno,@emanettar)")
			Token.ExecSQL("*", isyerino, tahsilno, tahsiltar, makbuz, makbuzmik, emanmikt, emanmikk, islemtar, kaykul, 1, tahsiltar)
		End Sub
	End Module

End Namespace
